* Send a requested VIDEO, AUDIO FILE or PLAYLIST to user from a redirected 'not found' request
* this script is used for file access from embed or external audio players
*
* 3 kind of audio file can be processed :
* - audio files (.mp3, .wav...)
* - existing playlist (.m3u files)
* - PHP playlist (used by audio explorer scripts), named *playlist*.m3u[.xml]
* - single mp3 playlist (used by audio explorer scripts),named *singleMP3*.mp3.xml, used to bypass flash player limitation (cannot read somme characters like "&"...)
* if a .xml extension is added on a m3u or a mp3 file, the actual output is converted to an XML playlist file designed for being red by flash player.
*
* All (mime) video files can be processed. Only simple "streaming" is supported (no playlist or XML stuff...)
*
* URI must be formated like "/ext/sess_$passedsessionId/resId$resId/[image/][w$width/][h$height/]urlencoded($filename)
* where "$id" is an active session id, and "urlencoded(filename)" is url-encoded requested
* file name (must include absolute path, and not relative path)
*
* If audio/$bitrate/ is specified, output file is reencoded with FFMPEG encoder
*
* If $filename is an existing m3u file, an modified m3u is sent to user, replacing song's filenames by
* reformated filenames (/external/sess_$id/...)
*
* If $fileName is *playlist*.m3u or *playlist*.m3u.xml,
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category NA
* @package NA
* @author Nicolas Bruley / Peer 2 World <contact@weezo.net>
* @copyright 2005-2009 Nicolas Bruley / Peer 2 World
* @desc reencode video to flv using ffmpeg, and stream result to output
*
* @param string $completeFilename : original video file name
* @param array $params: w (width), h (height), q (quality), noSound(), chunkOffset(offset in seconds from begining, used by video chunking), chunkLength(seconds), offset(overriden by chunkOffset)
* @param int $height
* @param string $outputQuality
*/
function videoGenerateFlashVideo($completeFilename, $params=array()){
// If link is not published video or streamed direct link, exit
if(!(@$token=$tokenList[$id])) cfLog('invalid published video id ('.$id.')',LOG_DBG);
if($token['type']!=='publishVideo' && ($token['type']!=='directLink' || @$token['streaming']!=='video')) cfLog('invalid published video id ('.$id.')',LOG_DBG);
// Check file's existence
if(!is_file($token['filename'])) logError('perempted published image ('.$token['filename'].')');